/* eslint-disable class-methods-use-this */
import _axios, { get, post, put, _delete } from '@/lin/plugin/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class ShopList {
  // constructor() {}

  // 类中的方法可以代表一个用户行为
  async createSaleList(data) {
    return _axios({
      method: 'post',
      url: 'saleList',
      data,
    })
  }

  async createReplenishApply(data) {
    return _axios({
      method: 'post',
      url: 'replenish',
      data,
    })
  }

  async getReplenishApplyList() {
    return _axios({
      method: 'get',
      url: 'replenish',
    })
  }

  async getReplenishApplyDetail(id) {
    const res = await get(`replenish/detail/${id}`)
    return res
  }


  async passReplenishApply(id, handlerId) {
    const res = await put(`replenish/pass/${id}/${handlerId}`)
    return res
  }

  async rejectReplenishApply(id) {
    const res = await put(`replenish/reject/${id}`)
    return res
  }

  async updateStatus(applyListId, statusId) {
    const res = await put(`replenish/status/${applyListId}/${statusId}`)
    return res
  }
}

export default new ShopList()
